<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">

    <div class="modal-header">
        <h4 class="modal-title" id="mySubjectLabel" jhiTranslate="gbSubjectApp.subject.home.createOrEditLabel">Create or edit a Subject</h4>
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
                (click)="clear()">&times;</button>
    </div>
    <div class="modal-body">
        <jhi-alert-error></jhi-alert-error>
        <div class="form-group" [hidden]="!subject.id">
            <label for="id" jhiTranslate="global.field.id">ID</label>
            <input type="text" class="form-control" id="id" name="id"
                   [(ngModel)]="subject.id" readonly />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="gbSubjectApp.subject.name" for="field_name">Name</label>
            <input type="text" class="form-control" name="name" id="field_name"
                [(ngModel)]="subject.name" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="gbSubjectApp.subject.code" for="field_code">Code</label>
            <input type="number" class="form-control" name="code" id="field_code"
                [(ngModel)]="subject.code" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="gbSubjectApp.subject.studentSum" for="field_studentSum">Student Sum</label>
            <input type="number" class="form-control" name="studentSum" id="field_studentSum"
                [(ngModel)]="subject.studentSum" />
        </div>

        <div class="form-group">
            <label class="form-control-label" jhiTranslate="gbSubjectApp.subject.subjectClazz" for="field_subjectClazz">Subject Clazz</label>
            <select class="form-control" id="field_subjectClazz" name="subjectClazz" [(ngModel)]="subject.subjectClazzId" >
                <option [ngValue]="null"></option>
                <option [ngValue]="subjectClazzOption.id" *ngFor="let subjectClazzOption of subjectclazzes; trackBy: trackSubjectClazzById">{{subjectClazzOption.name}}</option>
            </select>
        </div>
        <div class="form-group">
            <label jhiTranslate="gbSubjectApp.subject.college" for="field_college">College</label>
            <select class="form-control" id="field_college" multiple name="college" [(ngModel)]="subject.colleges">
                <option [ngValue]="getSelected(subject.colleges, collegeOption)" *ngFor="let collegeOption of colleges; trackBy: trackCollegeById">{{collegeOption.name}}</option>
            </select>
        </div>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
            <span class="fa fa-ban"></span>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
        </button>
        <button type="submit" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
            <span class="fa fa-save"></span>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
        </button>
    </div>
</form>
